package com.jsbj.enums;

import com.jsbj.tools.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.EnumSet;

@Getter
@AllArgsConstructor
public enum ConfigPushTypeEnum {
    QE_PZGCXM("QE_PZGCXM", "品质工程项目注册", "y9wMQD9e8yoOgC8WeAUx-HQP9um30BIhp5W9mjZxFlk"),
    QE_NOTICE("QE_NOTICE", "品质工程通知管理", "y9wMQD9e8yoOgC8WeAUx-HQP9um30BIhp5W9mjZxFlk")
   ;

    private String code;
    private String desc;
    private String templateId;

    public static String getDescByCode(String code)
    {
        String desc = "";
        if (StringUtils.isEmpty(code))
        {
            return "";
        }

        for (ConfigPushTypeEnum e : ConfigPushTypeEnum.toEnumSet())
        {
            if (e.getCode().equals(code))
            {
                desc = e.getDesc();
            }
        }
        return desc;
    }

    public static String getTemplateIdByCode(String code)
    {
        String templateId = "";
        if (StringUtils.isEmpty(code))
        {
            return "";
        }

        for (ConfigPushTypeEnum e : ConfigPushTypeEnum.toEnumSet())
        {
            if (e.getCode().equals(code))
            {
                templateId = e.getTemplateId();
            }
        }
        return templateId;
    }

    public static EnumSet<ConfigPushTypeEnum> toEnumSet()
    {
        return EnumSet.allOf(ConfigPushTypeEnum.class);
    }
}
